Prepare Interview

Mock Exams

Make Homepage

Bookmark this page

Subscribe Email Address

Tomcat Interview Questions and Answers

Question: How do you create multiple virtual hosts?
Answer: If you want tomcat to accept requests for different hosts e.g. www.myhostname.com then you must
  • Create ${catalina.home}/www/appBase , ${catalina.home}/www/deploy, and ${catalina.home}/conf/Catalina/www.myhostname.com
  • Add a host entry in the server.xml file 
  • Create the the following file under conf/Catalina/www.myhostname.com/ROOT.xml 
  • Add any parameters specific to this hosts webapp to this context file 
  • Put your war file in ${catalina.home}/www/deploy 
  • When tomcat starts, it finds the host entry, then looks for any context files and will start any apps with a context.
To add more sites just repeat and rinse, all webapps can share the same war file location and appbase.
Is it helpful? Yes No

Most helpful rated by users:

©2024 WithoutBook